/**
 */
package autoSAR.impl;

import autoSAR.AutoSARPackage;
import autoSAR.Entity;
import autoSAR.PostRecivePPort;
import autoSAR.PostReciveRPort;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Post Recive RPort</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link autoSAR.impl.PostReciveRPortImpl#getDataTo <em>Data To</em>}</li>
 *   <li>{@link autoSAR.impl.PostReciveRPortImpl#getReciveFrom <em>Recive From</em>}</li>
 * </ul>
 *
 * @generated
 */
public class PostReciveRPortImpl extends PostRecivePortImpl implements PostReciveRPort {
	/**
	 * The cached value of the '{@link #getDataTo() <em>Data To</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDataTo()
	 * @generated
	 * @ordered
	 */
	protected EList<Entity> dataTo;

	/**
	 * The cached value of the '{@link #getReciveFrom() <em>Recive From</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getReciveFrom()
	 * @generated
	 * @ordered
	 */
	protected EList<PostRecivePPort> reciveFrom;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PostReciveRPortImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return AutoSARPackage.Literals.POST_RECIVE_RPORT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Entity> getDataTo() {
		if (dataTo == null) {
			dataTo = new EObjectResolvingEList<Entity>(Entity.class, this, AutoSARPackage.POST_RECIVE_RPORT__DATA_TO);
		}
		return dataTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PostRecivePPort> getReciveFrom() {
		if (reciveFrom == null) {
			reciveFrom = new EObjectWithInverseResolvingEList.ManyInverse<PostRecivePPort>(PostRecivePPort.class, this,
					AutoSARPackage.POST_RECIVE_RPORT__RECIVE_FROM, AutoSARPackage.POST_RECIVE_PPORT__POST_TO);
		}
		return reciveFrom;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_RPORT__RECIVE_FROM:
			return ((InternalEList<InternalEObject>) (InternalEList<?>) getReciveFrom()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_RPORT__RECIVE_FROM:
			return ((InternalEList<?>) getReciveFrom()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_RPORT__DATA_TO:
			return getDataTo();
		case AutoSARPackage.POST_RECIVE_RPORT__RECIVE_FROM:
			return getReciveFrom();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_RPORT__DATA_TO:
			getDataTo().clear();
			getDataTo().addAll((Collection<? extends Entity>) newValue);
			return;
		case AutoSARPackage.POST_RECIVE_RPORT__RECIVE_FROM:
			getReciveFrom().clear();
			getReciveFrom().addAll((Collection<? extends PostRecivePPort>) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_RPORT__DATA_TO:
			getDataTo().clear();
			return;
		case AutoSARPackage.POST_RECIVE_RPORT__RECIVE_FROM:
			getReciveFrom().clear();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_RPORT__DATA_TO:
			return dataTo != null && !dataTo.isEmpty();
		case AutoSARPackage.POST_RECIVE_RPORT__RECIVE_FROM:
			return reciveFrom != null && !reciveFrom.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //PostReciveRPortImpl
